{% extends "base.html" %}
{% load post_tags %}
{% block title %}My blog{% endblock %}

{% block content %}
    <h1>{{ post.title }}</h1>
    <div class="module">
        <div class="course-info" id="course-info">
            {{ post.body|djangomarkdown }}
        </div>
        <br>
        <p><a class="myedit" href="{% url "post_edit" post.id %}">Edit</a></p>
    </div>
{% endblock %}
{% block sidebar %}
    <form action="" method="post">
        {{ form.search }}
        {% csrf_token %}
        <input type="submit" value="Search">
    </form>
{% endblock %}
{% block sidebar_second %}
    <ul>
        {% for post in posts %}
            {% for tag in post.tags.all %}
                <li style=" float:left;margin: 1px 5px;list-style:none;display:block;white-space: nowrap;width: 40%"><a
                        href="{% url "post_list_by_tag" tag.name %}">
                    {{ tag.name }}({{ forloop.counter }})
                </a></li>
                {% if not forloop.last %}, {% endif %}
            {% endfor %}
        {% endfor %}
    </ul>
{% endblock %}